home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 1 / Deutsche Edition 1.iso / amok / 051-060 / amok58 / kme / iconify.mod < prev    next >
Text File  |  1993-11-04  |  2KB  |  80 lines

  1. (*---------------------------------------------------------------------------
  2.     :Program.    Iconify
  3.     :Author.     Steffen Köhler
  4.     :Address.    Grüne Str. 1 D-2880 Brake
  5.     :Copyright.  PD
  6.     :Language.   Oberon
  7.     :Translator. Amiga Oberon V2.01 A+L
  8.     :Contents.   Stellt eine Iconify- Routine zur Verfügung
  9.     :History.    V1.0,   06-Nov-90:  first MODULA-2 Version (Steffen Köhler)
  10.     :History.    V1.0.o, 16-Jul-91:  ported this to OBERON (Christian Stiens)
  11. ---------------------------------------------------------------------------*)
  12.  
  13. MODULE Iconify;
  14.  
  15.   IMPORT I:Intuition,e:Exec,rq:Requests,SYSTEM;
  16.  
  17.   VAR MyWindowPtr: I.WindowPtr;
  18.  
  19.   PROCEDURE Iconify * (VAR x,y: INTEGER; Image: I.ImagePtr);
  20.     VAR
  21.       MyWindow     : I.NewWindow;
  22.       IntuiMsg     : I.IntuiMessagePtr;
  23.       MyGadget     : I.Gadget;
  24.       FirstClick,
  25.       EndFlag      : BOOLEAN;
  26.       LastSecond,
  27.       LastMicro,
  28.       Second,
  29.       Micro        : LONGINT;
  30.   BEGIN
  31.     MyGadget := I.Gadget(NIL,0,0,0,0,{I.gRelWidth,I.gRelHeight}+I.gadgHNone,
  32.                {I.gadgImmediate},I.wDragging,NIL,NIL,NIL,LONGSET{},NIL,0,NIL);
  33.     MyWindow := I.NewWindow(0,0,0,0,0,1,LONGSET{I.gadgetDown},
  34.                 LONGSET{I.noCareRefresh,I.borderless},NIL,
  35.                 NIL,NIL,NIL,NIL,0,0,-1,-1,{I.wbenchScreen});
  36.     MyWindow.leftEdge:= x;
  37.     MyWindow.topEdge := y;
  38.     MyWindow.width   := Image.width;
  39.     MyWindow.height  := Image.height;
  40.     MyWindow.firstGadget := SYSTEM.ADR(MyGadget);
  41.     MyWindowPtr := I.OpenWindow(MyWindow);
  42.     rq.Assert(MyWindowPtr # NIL,"Iconify-Window konnte nicht geöffnet werden!");
  43.     I.DrawImage(MyWindowPtr.rPort,Image^,0,0);
  44.     EndFlag := FALSE;
  45.     FirstClick := TRUE;
  46.     REPEAT
  47.       e.WaitPort(MyWindowPtr.userPort);
  48.       IntuiMsg := e.GetMsg(MyWindowPtr.userPort) ;
  49.       WHILE IntuiMsg # NIL DO
  50.        Second := IntuiMsg.time.secs;
  51.        Micro  := IntuiMsg.time.micro;
  52.        e.ReplyMsg(IntuiMsg) ;
  53.        IF NOT FirstClick THEN
  54.          EndFlag:=I.DoubleClick(LastSecond,LastMicro,Second,Micro);
  55.        ELSE
  56.          FirstClick:=FALSE;
  57.        END;
  58.        IntuiMsg := e.GetMsg(MyWindowPtr.userPort) ;
  59.        LastSecond:=Second;
  60.        LastMicro:=Micro;
  61.       END;
  62.     UNTIL EndFlag;
  63.     x := MyWindowPtr.leftEdge;
  64.     y := MyWindowPtr.topEdge;
  65.     I.CloseWindow(MyWindowPtr);
  66.     MyWindowPtr:=NIL;
  67.   END Iconify;
  68.  
  69.  
  70. BEGIN
  71.  
  72.   MyWindowPtr := NIL
  73.  
  74. CLOSE
  75.  
  76.   IF MyWindowPtr # NIL THEN I.CloseWindow(MyWindowPtr) END
  77.  
  78. END Iconify.
  79.  
  80.